//package com.lt.test.consumer.controller;
//
//import com.alibaba.dubbo.config.annotation.Reference;
//import com.lt.test.api.*;
//import com.lt.test.common.constant.HttpRequestConstant;
//import com.lt.test.common.exception.CustomException;
//import com.lt.test.common.util.ExcelUtil;
//import com.lt.test.common.util.StringUtils;
//import com.lt.test.common.util.WebUtils;
//import com.lt.test.entity.DTO.ActiveUser;
//import com.lt.test.entity.DTO.PageDTO;
//import com.lt.test.entity.DTO.ResponseDTO;
//import com.lt.test.entity.QueryModel.MapQueryModel;
//import com.lt.test.consumer.util.DateUtil;
//import net.sf.json.JSONArray;
//import net.sf.json.JSONObject;
//import net.sf.json.JsonConfig;
//import org.apache.poi.hssf.usermodel.HSSFWorkbook;
//import org.apache.shiro.SecurityUtils;
//import org.apache.shiro.subject.Subject;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.OutputStream;
//import java.io.UnsupportedEncodingException;
//import java.util.*;
//
///**
// * 创建人：lt
// * 创建时间：15:16 2018/1/25
// */
//@Controller
//@RequestMapping("/ktcount")
//public class KtCountController {
//    private static final Logger logger = LoggerFactory.getLogger(KtCountController.class);
//    /**
//     * 烟草订烟服务接口
//     */
//    @Reference(version = "1.0.0")
//    private SPLOrderService sPLOrderService;
//    /**
//     * 客户管理服务接口getktCollect
//     */
//    /**
//     * 缓存服务接口
//     */
//    @Reference(version = "1.0.0")
//    private RedisService redisService;
//
//    @Reference(version = "1.0.0")
//    private KtCountService ktCountService;  //扫码出货 service
//    @Reference(version = "1.0.0")
//	private KtCommonService ktCommonService;
//
//    /**
//     * 店铺管理服务接口
//     */
//    @Reference(version = "1.0.0")
//    private ShopService shopService;
//
//    /******* 科泰 **********/
//
//
//    /**
//     * 扫码出货统计
//     *
//     * @param lastOrderTime
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/getShipmentOrder")
//    public
//    @ResponseBody
//    ResponseDTO getShipmentOrder(String lastOrderTime, String shopName, HttpServletRequest request, HttpServletResponse response) throws CustomException {
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String, Object> result = new HashMap<>(4);
//        Subject subject = SecurityUtils.getSubject();
//        //用户身份信息
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//
//        //查询条件
//        Map<String, String> params = new HashMap<>();
//
//        params.put("empName", activeUser.getEmpName()); //用户是否是客户经理
//        params.put("realChannelName", activeUser.getRealChannelName()); //用户是否是渠道经理
//
//        //通过区县名称获取对于渠道号
//        String allChannleIds = sPLOrderService.getAllChannelIdByQuXianName(activeUser.getQuXianName());
//        params.put("allChannleIds", allChannleIds);
//        params.put("channelName", activeUser.getChannelName()); //实际上是市局名称
//        params.put("lastOrderTime", lastOrderTime); //最后更新时间
//        params.put("shopType", "1");
//
//        List<Map<String, Object>> ShipmentOrderList = null;
//        /*Map<String, Object> ShipmentOrderDayData = null;//按天查询的订单统计数据
//        Map<String, Object> ShipmentOrderMonthData = null;//按天查询的订单统计数据
//        Map<String, Object> ShipmentOrderYearData = null;//按天查询的订单统计数据*/
//        try {
//            ShipmentOrderList = ktCountService.findShipmentOrderByLsatCreateTime(params);
//            /*if (ShipmentOrderList != null && !ShipmentOrderList.isEmpty()) {
//                params.put("shopName", shopName);
//                ShipmentOrderDayData = shopService.findShipmentOrderDayData(params);
//                ShipmentOrderMonthData = shopService.findShipmentOrderMonthData(params);
//                ShipmentOrderYearData = shopService.findShipmentOrderYearData(params);
//            }*/
//            responseDTO.setSuccess(true);
//            responseDTO.setMessage("获取成功");
//            responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        } catch (CustomException e) {
//            e.printStackTrace();
//            responseDTO.setMessage(e.getMessage());
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            responseDTO.setMessage("未知错误");
//        }
//        result.put("ShipmentOrderList", ShipmentOrderList);
//        /*result.put("ShipmentOrderDayData", ShipmentOrderDayData);
//        result.put("ShipmentOrderMonthData", ShipmentOrderMonthData);
//        result.put("ShipmentOrderYearData", ShipmentOrderYearData);*/
//        responseDTO.setData(result);
//        return responseDTO;
//    }
//
//    /**
//     * 根据时间查询出货统计
//     *
//     * @return
//     */
//    @RequestMapping("/getKtShipmentOrderByTime")
//    public
//    @ResponseBody
//    ResponseDTO getShipmentOrderByTime(MapQueryModel params) throws Exception {
//
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        params.getStringMap().put("channelCode", activeUser.getChannelName());
//
//        String quXianName = params.getStringMap().get("quXianName");
//
//        if (StringUtils.isNot_NullOrTrimEmpty(activeUser.getEmpName())){
//            params.getStringMap().put("empName", activeUser.getEmpName());
//        }
//
//        if (activeUser.getQuXianName() != null && !"".equals(activeUser.getQuXianName())) {
//            quXianName = activeUser.getQuXianName();
//        }
//
//        if (quXianName != null && !quXianName.equals("")) {
//            String channelId = sPLOrderService.getIdByChannleName(quXianName);
//            params.getStringMap().put("parentChannelId", channelId == null ? "-99999" : channelId); //保证错误情况查不到数据
//        }
//
//        if (activeUser.getRealChannelName() != null && !"".equals(activeUser.getRealChannelName())) {
//            params.getStringMap().put("channelName", activeUser.getRealChannelName());
//        }
//
//        List<Map<String, Object>> ShipmentOrderList = new ArrayList<>();
//
//        addShipmentOrderList(ShipmentOrderList, params.getStringMap());
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(ShipmentOrderList);
//        return responseDTO;
//    }
//
//    /**
//     * 查询扫码出货的数据 ：
//     *      分次查询，避免数据过大而出现错误
//     * @param ShipmentOrderList 用于接收返回数据
//     * @param params 查询相关参数
//     * @throws CustomException
//     */
//    private void addShipmentOrderList(List<Map<String, Object>> ShipmentOrderList,Map<String,String> params) throws CustomException {
//        Integer page = 1;
//        Integer pageSize = 9000;
//        params.put("pageSize", pageSize.toString());
//        while (true) {
//            params.put("page", page.toString());
//            List<Map<String, Object>> resultData = ktCountService.getKtShipmentOrderByTime(params);
//            ShipmentOrderList.addAll(resultData);
//            if (resultData == null || resultData.size() < pageSize) {
//                break;
//            }
//            page++;
//        }
//    }
//
//    /**
//     /**
//     * 跳转到扫码出货统计页面
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/shipmentOrderDataStatistics")
//    public String shipmentorderDataStatistics(HttpServletRequest request, HttpServletResponse response) {
//
//        return "content/kt/ktShipmentOrderDataStatistics";
//    }
//    /**
//     * 入库单统计
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("ktInstore")
//    public ModelAndView shipktInstore(HttpServletRequest request, HttpServletResponse response){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        System.out.println("============> activeUser: "+activeUser.getRoleNo());
//        parameter.put("roleNo", activeUser.getRoleNo());
//        System.out.println("============> activeUser: "+activeUser.getUserId());
//        parameter.put("userId", activeUser.getClouderUser());
//        parameter.put("zoneCode", activeUser.getZoneCode());
//        parameter.put("stat", activeUser.getZoneCode());
//        System.out.println("============> parameter: "+parameter);
//    	List<Map<String, Object>> shopName = ktCommonService.getShopList2User(parameter);
//    	mav.addObject("shopnames",shopName);
//    	mav.setViewName("content/kt/ktInstore");
//    	return mav;
//    }
//
//    /**
//     * 获取入库单数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktInstore",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktInstore(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Long page = Long.valueOf(request.getParameter("offset"));
//        Long pageSize = Long.valueOf(request.getParameter("limit"));
//        String filters = request.getParameter("filters");
//        String sortName = request.getParameter("sortName");
//        String orderName = request.getParameter("orderName");
//
///*        if(filters != null && !filters.equals("")){
//        	filters = new String (filters.getBytes("iso8859-1"),"UTF-8");
//        }*/
//        JSONObject result = null;
////        try{
//        	result = ktCountService.getktInstore(page, pageSize, filters,sortName,orderName);
////        }catch(Exception e){
////        	logger.error("获取商品信息失败");
////            e.printStackTrace();
////            result = new PageDTO<>();
////        }
//        return result.toString();
//    }
//    /**
//     * 客户经理推广绩效
//     * @param request
//     * @param response
//     * @return
//     */
//
//    @RequestMapping("ktCmPerformance")
//    public ModelAndView ktCmPerformance(HttpServletRequest request, HttpServletResponse response){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	mav.setViewName("content/kt/ktCmPerformance");
//    	return mav;
//    }
//    /**
//     * 客户经理推广绩效
//     * @param request
//     * @return
//     * @throws Exception
//     */
//
//    @RequestMapping("/getktCmPerformance")
//    public @ResponseBody
//    String getktCmPerformance(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//        try{
//        	result = ktCountService.getCmPerformance(params);
//        }catch(Exception e){
//        	logger.error("获取商品信息失败");
//            e.printStackTrace();
//        }
//        return result.toString();
//    }
//
//    @RequestMapping("/exportExcelCmPerformance")
//    public void exportExcelCmPerformance(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//         String areaName = request.getParameter("areaName");
//         String customerName = request.getParameter("customerName");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String sortName = request.getParameter("sortName");
//         String sortOrder = request.getParameter("sortOrder");
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", "客户经理推广绩效统计");
//         map.put("serverTime","查询区间:"+ getRegionTime(turnCreateDate,bindCreateDate));
//        // map.put("footer", "盘点人：__________        复核人：__________");
//         //map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "客户经理推广绩效统计  -- "+DateUtil.formatterDate();
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("areaName", areaName);
//         params.getStringMap().put("customerName", customerName);
//         params.getStringMap().put("sortOrder", sortOrder);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.getCmPerformance(params.getStringMap());
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         Map<String, Object> statiticsRow = ktCountService.getStatisCmp(Keys, params.getStringMap());
//         ShipmentInStoreList.add(statiticsRow);
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("客户经理推广绩效统计",turnCreateDate,bindCreateDate,"") + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//
//    /**
//     * 零售户户支付情况查询
//     * @param request
//     * @param response
//     * @return
//     */
//
//    @RequestMapping("ktRetailerPayCond")
//    public ModelAndView ktRetailerPayCond(HttpServletRequest request, HttpServletResponse response){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	mav.setViewName("content/kt/ktRetailerPayCond");
//    	return mav;
//    }
//    /**
//     * author xubing
//     *   
//     * 跨行结算日报页
//     * @param request
//     * @param response
//     * @return
//     */
//
//    @RequestMapping("ktRetailerPayCond2")
//    public ModelAndView ktRetailerPayCond2(HttpServletRequest request, HttpServletResponse response){
//    	ModelAndView mav = new ModelAndView();
//    	mav.setViewName("content/kt/ktRetailerPayCond2");
//    	return mav;
//    }
//    /**
//     * author xubing
//     *   
//     * 跨行结算日报页
//     * @param request
//     * @param response
//     * @return
//     */
//
//    @RequestMapping("transRecord")
//    public ModelAndView transRecord(HttpServletRequest request, HttpServletResponse response){
//    	ModelAndView mav = new ModelAndView();
//    	mav.setViewName("content/kt/transRecord");
//    	return mav;
//    }
//    @RequestMapping("multBindRecord")
//    public ModelAndView multBindRecord(HttpServletRequest request, HttpServletResponse response){
//    	ModelAndView mav = new ModelAndView();
//    	mav.setViewName("content/kt/multBindRecord");
//    	return mav;
//    }
//    /**
//     * 零售户户支付情况查询
//     * @param request
//     * @return
//     * @throws Exception
//     */
//
//    @RequestMapping(value = "/getktRetailerPayCond",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktRetailerPayCond(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//        try{
//        	result = ktCountService.getRetailerPayCond(params);
//        }catch(Exception e){
//        	logger.error("获取商品信息失败");
//            e.printStackTrace();
//        }
//        return result.toString();
//    }
//    /**
//     * auther xubing
//     * 跨行支付日报查询
//     * @param request
//     * @return
//     * @throws Exception
//     */
//
//    @RequestMapping(value = "/getktRetailerPayCond2",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktRetailerPayCond2(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//        try{
//        	result = ktCountService.listIBCPDaily(params);
//        }catch(Exception e){
//        	logger.error("获取跨行支付日结信息失败");
//            e.printStackTrace();
//        }
//        return result.toString();
//    }
//    /**
//     * auther xubing
//     * 跨行支付交易记录查询
//     * @param request
//     * @return
//     * @throws Exception
//     */
//
//    @RequestMapping(value = "/listTrans",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String listTrans(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//        try{
//        	result = ktCountService.listTrans(params);
//        }catch(Exception e){
//        	logger.error("获取跨行支付交易记录信息失败");
//            e.printStackTrace();
//        }
//        return result.toString();
//    }
//    @RequestMapping(value = "/listMultBind",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String listMultBind(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//        try{
//        	result = ktCountService.listMultBind(params);
//        }catch(Exception e){
//        	logger.error("获取一卡多绑信息失败");
//            e.printStackTrace();
//        }
//        return result.toString();
///*        String sss= "{\n" +
//                "  \"total\": 75,\n" +
//                "  \"rows\": [\n" +
//                "    {\n" +
//                "      \"ACCNO\": \"6212264000035961198\",\n" +
//                "      \"MERID\": \"301440344580002\",\n" +
//                "      \"MERNAME\": \"深圳市烟草公司（罗湖）\",\n" +
//                "      \"CUSTOMERNAME\": \"深圳市罗湖区靖轩便利店\",\n" +
//                "      \"CUSTOMERID\": \"440303105158\"\n" +
//                "    },\n" +
//                "    {\n" +
//                "      \"ACCNO\": \"6212264000035961198\",\n" +
//                "      \"MERID\": \"301440344580002\",\n" +
//                "      \"MERNAME\": \"深圳市烟草公司（罗湖）\",\n" +
//                "      \"CUSTOMERNAME\": \"靖业便利店\",\n" +
//                "      \"CUSTOMERID\": \"440303206135\"\n" +
//                "    },\n" +
//                "    {\n" +
//                "      \"ACCNO\": \"6212264000046733586\",\n" +
//                "      \"MERID\": \"105440344580001\",\n" +
//                "      \"MERNAME\": \"深圳市烟草公司（福田）\",\n" +
//                "      \"CUSTOMERNAME\": \"深圳市福田区家家顺源便利店\",\n" +
//                "      \"CUSTOMERID\": \"440304105962\"\n" +
//                "    },\n" +
//                "  ]\n" +
//                "}";
//        return sss;*/
//    }
//    @RequestMapping(value = "/listMultBindTrans",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String listMultBindTrans(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//        try{
//        	result = ktCountService.listMultBindTrans(params);
//        }catch(Exception e){
//        	logger.error("获取一卡多绑交易记录失败");
//            e.printStackTrace();
//        }
//        return result.toString();
//    }
//
//
//    @RequestMapping("/exportExcelRetailerPayCond")
//    public void exportExcelRetailerPayCond(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//
//         String areaName = request.getParameter("areaName");
//         String customerId = request.getParameter("customerId");
//         String orderState = request.getParameter("orderState");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String sortName = request.getParameter("sortName");
//         String sortOrder = request.getParameter("sortOrder");
//
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", "零售户户支付情况");
//         map.put("serverTime","查询区间:"+ getRegionTime(turnCreateDate,bindCreateDate));
//        // map.put("footer", "盘点人：__________        复核人：__________");
//         //map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//
//         String fileName = "零售户户支付情况  -- "+DateUtil.formatterDate();
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("areaName", areaName);
//         params.getStringMap().put("customerId", customerId);
//         params.getStringMap().put("orderState", orderState);
//         params.getStringMap().put("sortOrder", sortOrder);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.getRetailerPayCond(params.getStringMap());
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("零售户户支付情况",turnCreateDate,bindCreateDate,"") + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    @RequestMapping("/exportExcelIbcpDaily")
//    public void exportExcelIbcpDaily(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        //ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//
//         String merid = request.getParameter("merid");
//         String meridName = request.getParameter("meridName");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//
//
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", meridName);
//         map.put("serverTime","查询时间区间:"+ turnCreateDate+"至"+bindCreateDate);
//        // map.put("footer", "盘点人：__________        复核人：__________");
//         //map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("merid", merid);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.listIBCPDaily(params.getStringMap());
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((meridName+DateUtil.formatterDate(turnCreateDate, "yyyy-MM-dd hh:mm:ss")+"至"+DateUtil.formatterDate("yyyy-MM-dd hh:mm:ss") + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    @RequestMapping("/exportExcelTransRecord")
//    public void exportExcelTransRecord(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        //ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//
//         String merid = request.getParameter("merid");
//         String meridName = request.getParameter("meridName");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//
//
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", meridName);
//         map.put("serverTime","查询时间区间:"+ turnCreateDate+"至"+bindCreateDate);
//        // map.put("footer", "盘点人：__________        复核人：__________");
//         //map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("merid", merid);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.listTrans(params.getStringMap());
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((meridName+"交易记录"+DateUtil.formatterDate(turnCreateDate, "yyyy-MM-dd hh:mm:ss")+"至"+DateUtil.formatterDate("yyyy-MM-dd hh:mm:ss") + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    @RequestMapping("/exportExcelMultBind")
//    public void exportExcelMultBind(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        //ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//
//         String merid = request.getParameter("merid");
//         String meridName = request.getParameter("meridName");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//
//
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", meridName);
//         map.put("serverTime","查询时间区间:"+bindCreateDate);
//        // map.put("footer", "盘点人：__________        复核人：__________");
//         //map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("merid", merid);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.listMultBind(params.getStringMap());
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((meridName+"一卡多绑记录.xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//
//
//    /**
//     * 入库单统计
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("ktStockItem")
//    public ModelAndView ktStockItem(HttpServletRequest request, HttpServletResponse response){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        System.out.println("============> activeUser: "+activeUser.getRoleNo());
//        parameter.put("roleNo", activeUser.getRoleNo());
//        System.out.println("============> activeUser: "+activeUser.getUserId());
//        parameter.put("userId", activeUser.getClouderUser());
//        parameter.put("zoneCode", activeUser.getZoneCode());
//        parameter.put("stat", activeUser.getZoneCode());
//        System.out.println("============> parameter: "+parameter);
//    	mav.setViewName("content/kt/ktStockItem");
//    	return mav;
//    }
//
//    /**
//     * 获取入库单数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktStockItem",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktStockItem(HttpServletRequest request, HttpServletResponse response) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        response.setContentType("text/plain; charset=UTF-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//        try{
//        	int summaryType = Integer.parseInt(params.get("summaryType"));
//        	result = ktCountService.getStockItem(params,summaryType);
//        	if(summaryType == 0){
//        	List<Map<String, Object>> list = (List<Map<String, Object>>)result.get("rows");
//        	List<Map<String, String>> foreAreaTypes = new ArrayList<Map<String, String>>();
//            if(!redisService.exists("foreAreaTypes1")){
//            	foreAreaTypes = ktCountService.findSourceArea();
//            	redisService.set("foreAreaTypes1", foreAreaTypes, 86400L);
//            }else{
//            	foreAreaTypes = (List<Map<String, String>>)redisService.get("foreAreaTypes1");
//            }
//            String[] cols = {"STOCK","AMOUNT","REPOSITORY_STOCK","SHOP_STOCK"};
//            list = getSubAreatotals(foreAreaTypes,list,cols);
//            result.put("rows", list);
//        	}
//        }catch(Exception e){
//        	logger.error("获取商品信息失败");
//            e.printStackTrace();
//        }
//        return result.toString();
//    }
//
//    /**
//     * 入库单统计
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("ktInstockItem")
//    public ModelAndView ktInstockItem(HttpServletRequest request, HttpServletResponse response){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        parameter.put("roleNo", activeUser.getRoleNo());
//        parameter.put("userId", activeUser.getClouderUser());
//        parameter.put("zoneCode", activeUser.getZoneCode());
//        parameter.put("stat", activeUser.getZoneCode());
//    	mav.setViewName("content/kt/ktInstockItem");
//    	return mav;
//    }
//
//    /**
//     * 获取入库单数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktInstockItem",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktInstockItem(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        int summaryType = Integer.parseInt(params.get("summaryType"));
//        JSONObject result = null;
//        try{
//        	result = ktCountService.getInstockItem(params,summaryType);
//        }catch(Exception e){
//        	logger.error("获取商品信息失败");
//            e.printStackTrace();
//        }
//        return result.toString();
//    }
//    @RequestMapping("/exportExcelInstockItem")
//    public void exportExcelInstockItem(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//         String orderNo = request.getParameter("orderNo");
//         String shortCode = request.getParameter("shortCode");
//         String productName = request.getParameter("productName");
//         String shopName = request.getParameter("shopName");
//         String shopIdName = request.getParameter("shopIdName");
//         String prodType = request.getParameter("prodType");
//         String foreTypeName = request.getParameter("foreTypeName");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String sortName = request.getParameter("sortName");
//         String sortOrder = request.getParameter("sortOrder");
//         int summaryType = Integer.parseInt(request.getParameter("summaryType"));
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("areaServiceName", shopIdName);
//         map.put("sheetName", "门店入库单表");
//         map.put("serverTime","查询区间:"+ getRegionTime(turnCreateDate,bindCreateDate)+"        商品类别:"+getforeTypeNameStr(foreTypeName));
//         map.put("footer", "盘点人：__________        复核人：__________");
//         //map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "门店入库单表 -- "+DateUtil.formatterDate();
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("shortCode", shortCode);
//         params.getStringMap().put("orderNo", orderNo);
//         params.getStringMap().put("productName", productName);
//         params.getStringMap().put("prodType", prodType);
//         params.getStringMap().put("shopName", shopName);
//         params.getStringMap().put("sortName", sortName);
//         params.getStringMap().put("sortOrder", sortOrder);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.getInstockItem(params.getStringMap(),summaryType);
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         Map<String, Object> statiticsRow = ktCountService.getStatisInstockItem(Keys, params.getStringMap());
//         ShipmentInStoreList.add(statiticsRow);
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createSIHSSFWorkbook(ShipmentInStoreList, Keys, columnNames,new String[]{"ID","OPERATOR_TIME"});
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("门店入库单表",turnCreateDate,bindCreateDate,"") + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    /**
//     * 销售汇总
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("ktSellItem")
//    public ModelAndView ktSellItem(HttpServletRequest request, HttpServletResponse response){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        parameter.put("roleNo", activeUser.getRoleNo());
//        parameter.put("userId", activeUser.getClouderUser());
//        parameter.put("zoneCode", activeUser.getZoneCode());
//        parameter.put("stat", activeUser.getZoneCode());
//    	mav.setViewName("content/kt/ktSellItem");
//    	return mav;
//    }
//
//    /**
//     * 获取入库单数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktSellItem",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktSellItem(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//        try{
//        	int summaryType = Integer.parseInt(params.get("summaryType"));
//        	result = ktCountService.getSellItem(params,summaryType);
//        	if(summaryType == 0){
//        	List<Map<String, Object>> list = (List<Map<String, Object>>)result.get("rows");
//        	List<Map<String, String>> foreAreaTypes = new ArrayList<Map<String, String>>();
//            if(!redisService.exists("foreAreaTypes1")){
//            	foreAreaTypes = ktCountService.findSourceArea();
//            	redisService.set("foreAreaTypes1", foreAreaTypes, 86400L);
//            }else{
//            	foreAreaTypes = (List<Map<String, String>>)redisService.get("foreAreaTypes1");
//            }
//            String[] cols = {"QUANTITY","AMOUNT"};
//            list = getSubAreatotals(foreAreaTypes,list,cols);
//            result.put("rows", list);
//        	}
//
//        }catch(Exception e){
//        	logger.error("获取商品信息失败");
//            e.printStackTrace();
//        }
//        return result.toString();
//    }
//    /**
//     * 数据汇总页面跳转
//     * @return
//     */
//    @RequestMapping("ktCollect")
//    public String KtCollect(){
//        return "content/kt/ktCollect";
//    }
//
//    /**
//     * 获取汇总数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktCollect",produces = "application/json; charset=UTF-8")
//    public
//    @ResponseBody
//    ResponseDTO getktCollect(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> result = WebUtils.getAllParamMap(request);
//        ResponseDTO responseDTO = new ResponseDTO();
//        System.out.println("=============> 开始获取汇总数据");
//        List data = ktCountService.getKtCollect(result);
//        responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        responseDTO.setMessage("获取汇总数据成功");
//        responseDTO.setSuccess(true);
//        responseDTO.setData(data);
//        return responseDTO;
//    }
//
//    /**
//     * 采购页面跳转
//     * @return
//     */
//    @RequestMapping("ktInsCargo")
//    public String ktInsCargo(HttpServletRequest request, Model model){
//        Map<String, String> result = WebUtils.getAllParamMap(request);
//        String shopId = result.get("shopId") == null ? "" : result.get("shopId").toString();
//        String supplierId = result.get("shopId") == null ? "" : result.get("shopId").toString();
//        String turnCreateDate = result.get("turnCreateDate") == null ? "" : result.get("turnCreateDate").toString();
//        String bindCreateDate = result.get("bindCreateDate") == null ? "" : result.get("bindCreateDate").toString();
//        model.addAttribute("shopId", shopId);
//        model.addAttribute("supplierId", supplierId);
//        model.addAttribute("turnCreateDate", turnCreateDate);
//        model.addAttribute("bindCreateDate", bindCreateDate);
//        return "content/kt/ktInsCargo";
//    }
//
//    /**
//     * 获取采购数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getKtInsCargo",produces = "application/json; charset=UTF-8")
//    public
//    @ResponseBody
//    ResponseDTO getKtInsCargo(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> result = WebUtils.getAllParamMap(request);
//        ResponseDTO responseDTO = new ResponseDTO();
//        System.out.println("=============> 开始获取采购数据");
//        List data = ktCountService.getKtInsCargo(result);
//        responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        responseDTO.setMessage("获取汇总数据成功");
//        responseDTO.setSuccess(true);
//        responseDTO.setData(data);
//        return responseDTO;
//    }
//
//    /**
//     * 退货页面跳转
//     * @return
//     */
//    @RequestMapping("ktOutCargo")
//    public String ktOutCargo(HttpServletRequest request, Model model){
//        Map<String, String> result = WebUtils.getAllParamMap(request);
//        String shopId = result.get("shopId") == null ? "" : result.get("shopId").toString();
//        String supplierId = result.get("shopId") == null ? "" : result.get("shopId").toString();
//        String turnCreateDate = result.get("turnCreateDate") == null ? "" : result.get("turnCreateDate").toString();
//        String bindCreateDate = result.get("bindCreateDate") == null ? "" : result.get("bindCreateDate").toString();
//        model.addAttribute("shopId", shopId);
//        model.addAttribute("supplierId", supplierId);
//        model.addAttribute("turnCreateDate", turnCreateDate);
//        model.addAttribute("bindCreateDate", bindCreateDate);
//        return "content/kt/ktOutCargo";
//    }
//
//    /**
//     * 获取退货数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping("/getKtOutCargo")
//    public
//    @ResponseBody
//    ResponseDTO getKtOutCargo(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> result = WebUtils.getAllParamMap(request);
//        ResponseDTO responseDTO = new ResponseDTO();
//        System.out.println("=============> 开始获取汇总数据");
//        List data = ktCountService.getKtOutCargo(result);
//        responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        responseDTO.setMessage("获取汇总数据成功");
//        responseDTO.setSuccess(true);
//        responseDTO.setData(data);
//        return responseDTO;
//    }
//
//    /**
//     * 分类烟销售量页面跳转
//     * @return
//     */
//    @RequestMapping(value = "classifiedTobaccoSales")
//    public String classifiedTobaccoSales(){
//        return "content/kt/ktClassifiedTobaccoSales";
//    }
//
//    /**
//     * 获取分类烟销售量数据列表
//     * @return
//     */
//    @RequestMapping(value = "gatKtClassifiedTobaccoSales")
//    public
//    @ResponseBody
//    ResponseDTO getKtClassifiedTobaccoSales(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> result = WebUtils.getAllParamMap(request);
//        ResponseDTO responseDTO = new ResponseDTO();
//        System.out.println("=============> 开始获取分类烟销售量数据");
//        List data = ktCountService.gatKtClassifiedTobaccoSales(result);
//        responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        responseDTO.setMessage("获取汇总数据成功");
//        responseDTO.setSuccess(true);
//        responseDTO.setData(data);
//        return responseDTO;
//    }
//    @RequestMapping("/exportExcelInStore")
//    public void exportExcelInStore(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//         String supplierName = request.getParameter("supplierName");
//         String productCode = request.getParameter("productCode");
//         String productName = request.getParameter("productName");
//         String prodType = request.getParameter("prodType");
//         String foreTypeName = request.getParameter("foreTypeName");
//         Object shopName = request.getParameter("shopName");
//         String shopIdName = request.getParameter("shopIdName");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String sortName = request.getParameter("sortName");
//         String orderName = request.getParameter("orderName");
//         JSONArray filters = new JSONArray();
//    	 if (shopName!=null && !"".equals(shopName)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "z.SHOP_ID");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+shopName+")");
//    		 filters.add(json);
//    	 }
//    	 if (supplierName!=null && !"".equals(supplierName)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "sp.SUPPLIER_ID");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+supplierName+")");
//    		 filters.add(json);
//    	 }
//    	 if (prodType!=null && !"".equals(prodType)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "t.TYPE_ID");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+prodType+")");
//    		 filters.add(json);
//    	 }
//    	 if (productCode!=null && !"".equals(productCode)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "p.PRODUCT_CODE");
//    		 json.accumulate("ft", "like");
//    		 json.accumulate("fv", "'%"+productCode+"%'");
//    		 filters.add(json);
//    	 }
//    	 if (productName!=null && !"".equals(productName)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "p.PRODUCT_NAME");
//    		 json.accumulate("ft", "like");
//    		 json.accumulate("fv", "'%"+productName+"%'");
//    		 filters.add(json);
//    	 }
//
//    	 if (turnCreateDate!=null && !"".equals(turnCreateDate)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "soi.STATE_DATE");
//    		 json.accumulate("ft", ">=");
//    		 json.accumulate("fv", "to_date('"+turnCreateDate+"','yyyy-MM-dd hh24:mi:ss')");
//    		 filters.add(json);
//    	 }
//    	 if (bindCreateDate!=null && !"".equals(bindCreateDate)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "soi.STATE_DATE");
//    		 json.accumulate("ft", "<=");
//    		 json.accumulate("fv", "to_date('"+bindCreateDate+"','yyyy-MM-dd hh24:mi:ss')");
//    		 filters.add(json);
//    	 }
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", "入库单统计 ");
//         map.put("serverTime", "时间:"+DateUtil.formatterDate());
//         map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"",shopIdName,foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "入库单统计  -- "+DateUtil.formatterDate();
//         while (true) {
//        	 Integer beginNum = (page - 1)* pageSize;
//        	 Integer endNum = beginNum + pageSize;
//             params.getStringMap().put("beginNum", beginNum.toString());
//             params.getStringMap().put("endNum", endNum.toString());
//             JSONObject resultData = ktCountService.getktInstore(Long.valueOf(page),Long.valueOf(pageSize),filters.toString(),sortName,orderName);
//             List<Map<String, Object>> result = (List<Map<String, Object>>) resultData.get("rows");
//             ShipmentInStoreList.addAll(result);
//             if (result == null || result.size() < pageSize) {
//                 break;
//             }
//             page++;
//         }
//         logger.info("添加sheetName的Map");
//         Map<String, Object> statiticsRow = ktCountService.getStatisInstore(Keys, filters.toString());
//         ShipmentInStoreList.add(statiticsRow);
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("入库单统计",turnCreateDate,bindCreateDate,shopIdName) + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//
//    @RequestMapping("/exportExcelTaskAnalysis")
//    public void exportExcelTaskAnalysis(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//        logger.info("开始生成excel表格");
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        String exportExcelData = request.getParameter("exportExcelData");
//        String turnCreateDate = request.getParameter("turnCreateDate");
//        String bindCreateDate = request.getParameter("bindCreateDate");
//        String productName = request.getParameter("productName");
//        String prodType = request.getParameter("prodType");
//        String foreTypeName = request.getParameter("foreTypeName");
//        String productCode = request.getParameter("productCode");
//        String colsTitles = request.getParameter("colsTitles");
//        String colsFields = request.getParameter("colsFields");
//        String sortName = request.getParameter("sortName");
//        String sortOrder = request.getParameter("sortOrder");
//        JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//        List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//        logger.info("json转List完毕");
//        Map<String, Object> map = new HashMap<>();
//
//        String[] Keys = new String[0];
//        String[] columnNames = new String[0];
//
//        Integer page = 0;
//        Integer pageSize = 10000;
//
//        ShipmentInStoreList.clear();
//        map.put("sheetName", "任务进度表 ");
//        map.put("serverTime", "时间:"+DateUtil.formatterDate());
//        map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//        Keys = String2Array(colsFields);
//        columnNames = String2Array(colsTitles);
//        String fileName = "任务进度表  -- "+DateUtil.formatterDate();
//        params.getStringMap().put("turnCreateDate", turnCreateDate);
//        params.getStringMap().put("bindCreateDate", bindCreateDate);
//        params.getStringMap().put("productName", productName);
//        params.getStringMap().put("prodType", prodType);
//        params.getStringMap().put("productCode", productCode);
//        params.getStringMap().put("sortName", sortName);
//        params.getStringMap().put("sortOrder", sortOrder);
//        List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//        while (true) {
//            params.getStringMap().put("offset", page.toString());
//            params.getStringMap().put("limit", pageSize.toString());
//            JSONObject json = ktCountService.getktTaskAnalyse(params.getStringMap());
//            List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//            list.addAll(resultData);
//            if (resultData == null || resultData.size() < pageSize) {
//                break;
//            }
//            page+=pageSize;
//        }
//        ShipmentInStoreList.addAll(list);
//        logger.info("添加sheetName的Map");
//        ShipmentInStoreList.add(0, map);
//        logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//        HSSFWorkbook wb;
//        try {
//            wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//        }catch (IllegalArgumentException e) {
//            e.printStackTrace();
//            throw new CustomException("数据实在太大，建议分多次导出");
//        }
//
//        logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//        OutputStream out = response.getOutputStream();
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("任务进度表",turnCreateDate,bindCreateDate,"") + ".xls").getBytes(), "iso-8859-1"));
//        response.setContentType("application/msexcel;charset=UTF-8");
//        logger.info("设置响应信息完成");
//        //输出excel文件
//        wb.write(out);
//        out.close();
//        logger.info("结束生成excel表格");
//    }
//
//    private static String[] String2Array(String str){
//    	return str.split(",");
//    }
//    /**
//     * 获取店铺名称用来展示
//     *
//     * @return
//     */
//    @RequestMapping("/getShopNameToSelect")
//    public
//    @ResponseBody
//    ResponseDTO getShopNameToSelect(HttpServletRequest request,String shopType) throws Exception {
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> result = WebUtils.getAllParamMap(request);
//
//        Map<String, String> params = new HashMap<>(3);
//        params.put("userId", activeUser.getUserId());
//        params.put("shopType", shopType);
//        List<Map<String, Object>> ShipmentOrderList = ktCountService.getShopNameToSelect(params);
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(ShipmentOrderList);
//        return responseDTO;
//    }
//    @RequestMapping(value = "ktPss")
//    public ModelAndView ktPss(HttpServletRequest request){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        System.out.println("============> activeUser: "+activeUser.getRoleNo());
//        parameter.put("roleNo", activeUser.getRoleNo());
//        System.out.println("============> activeUser: "+activeUser.getUserId());
//        parameter.put("userId", activeUser.getClouderUser());
//        parameter.put("zoneCode", activeUser.getZoneCode());
//        List<Map<String, Object>> shopName = ktCommonService.getShopList2User(parameter);
//        System.out.println("============>shopName " + shopName);
//    	mav.addObject("shopnames",shopName);
//        System.out.println("============> parameter: "+parameter);
//    	mav.setViewName("content/kt/ktPss");
//        return mav;
//    }
//
//    /**
//     * 获取进销存数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktPss",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktPss(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        String searchType = params.get("typeRadio");
//        JSONObject result = null;
////        try{
//        	result = ktCountService.getKtPss(params,Integer.parseInt(searchType));
////        }catch(Exception e){
////        	logger.error("获取商品信息失败");
////            e.printStackTrace();
////            result = new PageDTO<>();
////        }
//        return result.toString();
//    }
//
//    @RequestMapping("/exportExcelPss")
//    public void exportExcelPss(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//         String productName = request.getParameter("productName");
//         String prodType = request.getParameter("prodType");
//         String brandName = request.getParameter("brandName");
//         String foreTypeName = request.getParameter("foreTypeName");
//         String shopName = request.getParameter("shopName");
//         String shopIdName = request.getParameter("shopIdName");
//         //String areaCode = request.getParameter("areaCode");
//         String areaName = request.getParameter("areaName");
//         String supplierId = request.getParameter("supplierId");
//         String productCode = request.getParameter("productCode");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String searchType = request.getParameter("typeRadio");
//         String sortName = request.getParameter("sortName");
//         String sortOrder = request.getParameter("sortOrder");
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", "进销存报表 ");
//         map.put("serverTime", "时间:"+DateUtil.formatterDate());
//         map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,areaName,shopIdName,foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "进销存报表  -- "+DateUtil.formatterDate();
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("productName", productName);
//         params.getStringMap().put("prodType", prodType);
//         params.getStringMap().put("shopName", shopName);
//         //params.getStringMap().put("areaCode", areaCode);
//         params.getStringMap().put("supplierId", supplierId);
//         params.getStringMap().put("productCode", productCode);
//         params.getStringMap().put("brandName", brandName);
//         params.getStringMap().put("sortName", sortName);
//         params.getStringMap().put("sortOrder", sortOrder);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.getKtPss(params.getStringMap(),Integer.parseInt(searchType));
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         if (Integer.parseInt(searchType) == 0) {
//        	 List<Map<String, String>> foreProdTypes = new ArrayList<Map<String, String>>();
//        	 if(!redisService.exists("findProductType1")){
//        		 foreProdTypes = ktCountService.findProductType("1");
//        		 redisService.set("findProductType1", foreProdTypes, 86400L);
//        	 }else{
//        		 foreProdTypes = (List<Map<String, String>>)redisService.get("findProductType1");
//        	 }
//         	String[] cols = {"FSTOCK","FST","FSR","QTT","QRJE","QRCB","QRC","CQ","CAMT","PFSL","PFJE",
//        			"YIQUANTITY","YIQP","IQUANTITY","IQP","OQUANTITY","OQP","TQUANTITY","TQJE","LSTOCK",
//        			"LST","LSR","BHSJCJE","BHSCGJE","DCCBJE","DRCBJE","QTJE","CBCYJE","XSKBJE"};
//        	 list = getSubtotals(foreProdTypes,list,cols);
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         Map<String, Object> statiticsRow = ktCountService.getStatisPss(Keys, params.getStringMap());
//         ShipmentInStoreList.add(statiticsRow);
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("进销存报表",turnCreateDate,bindCreateDate,shopIdName) + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    @RequestMapping(value = "ktSsAnalyse")
//    public ModelAndView ktSsAnalyse(HttpServletRequest request){
//    	ModelAndView mav = new ModelAndView();
//    	mav.setViewName("content/kt/ktSsAnalyse");
//        return mav;
//    }
//
//    @RequestMapping(value = "ktTaskAnalysis")
//    public ModelAndView ktTaskAnalysis(HttpServletRequest request){
//        ModelAndView mav = new ModelAndView();
//        mav.setViewName("content/kt/ktTaskAnalysis");
//        return mav;
//    }
//
//    /**
//     * 获取进销存数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktSsAnalyse",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktSsAnalyse(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        String searchType = params.get("typeRadio");
//        JSONObject result = null;
////        try{
//        	result = ktCountService.getKtSsAnalyse(params);
////        }catch(Exception e){
////        	logger.error("获取商品信息失败");
////            e.printStackTrace();
////            result = new PageDTO<>();
////        }
//        return result.toString();
//    }
//
//    @RequestMapping("/exportExcelSsAnalyse")
//    public void exportExcelSsAnalyse(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//         String productName = request.getParameter("productName");
//         String prodType = request.getParameter("prodType");
//         String foreTypeName = request.getParameter("foreTypeName");
//         String productCode = request.getParameter("productCode");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String sortName = request.getParameter("sortName");
//         String sortOrder = request.getParameter("sortOrder");
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", "商品库存分析报表 ");
//         map.put("serverTime", "时间:"+DateUtil.formatterDate());
//         map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "商品库存分析报表  -- "+DateUtil.formatterDate();
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("productName", productName);
//         params.getStringMap().put("prodType", prodType);
//         //params.getStringMap().put("areaCode", areaCode);
//         params.getStringMap().put("productCode", productCode);
//         params.getStringMap().put("sortName", sortName);
//         params.getStringMap().put("sortOrder", sortOrder);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.getKtSsAnalyse(params.getStringMap());
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("商品库存分析报表",turnCreateDate,bindCreateDate,"") + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    @RequestMapping("/exportExcelStockItem")
//    public void exportExcelStockItem(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//         String productName = request.getParameter("productName");
//         String shortCode = request.getParameter("shortCode");
//         String shopName = request.getParameter("shopName");
//         String shopIdName = request.getParameter("shopIdName");
//         String summaryType = request.getParameter("summaryType");
//         String prodType = request.getParameter("prodType");
//         String foreTypeName = request.getParameter("foreTypeName");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String sortName = request.getParameter("sortName");
//         String sortOrder = request.getParameter("sortOrder");
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("areaServiceName", shopIdName);
//         map.put("sheetName", "商品库存盘点表");
//         map.put("serverTime", "时间:"+DateUtil.formatterDate("yyyy-MM-dd HH:mm:ss")+"        "+"商品类别:"+getforeTypeNameStr(foreTypeName));
//         map.put("footer", "盘点人：__________        复核人：__________");
//         //map.put("sheetName", "商品库存盘点表  -- "+DateUtil.formatterDate());
//         //map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "商品库存盘点表  -- "+DateUtil.formatterDate();
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("shortCode", shortCode);
//         params.getStringMap().put("productName", productName);
//         params.getStringMap().put("prodType", prodType);
//         params.getStringMap().put("shopName", shopName);
//         params.getStringMap().put("sortName", sortName);
//         params.getStringMap().put("sortOrder", sortOrder);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.getStockItem(params.getStringMap(),Integer.parseInt(summaryType));
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         if(Integer.parseInt(summaryType) == 0){
//	        List<Map<String, String>> foreAreaTypes = new ArrayList<Map<String, String>>();
//	        if(!redisService.exists("foreAreaTypes1")){
//	        	foreAreaTypes = ktCountService.findSourceArea();
//	        	redisService.set("foreAreaTypes1", foreAreaTypes, 86400L);
//	        }else{
//	        	foreAreaTypes = (List<Map<String, String>>)redisService.get("foreAreaTypes1");
//	        }
//	        String[] cols = {"STOCK"};
//	        list = getSubAreatotals(foreAreaTypes,list,cols);
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         Map<String, Object> statiticsRow = ktCountService.getStatisStockItem(Keys, params.getStringMap());
//         ShipmentInStoreList.add(statiticsRow);
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("商品库存盘点表",turnCreateDate,bindCreateDate,"") + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    @RequestMapping("/exportExcelSellItem")
//    public void exportExcelSellItem(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//         String shortCode = request.getParameter("shortCode");
//         String productName = request.getParameter("productName");
//         String shopName = request.getParameter("shopName");
//         String shopIdName = request.getParameter("shopIdName");
//         String summaryType = request.getParameter("summaryType");
//         String prodType = request.getParameter("prodType");
//         String foreTypeName = request.getParameter("foreTypeName");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String sortName = request.getParameter("sortName");
//         String sortOrder = request.getParameter("sortOrder");
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("areaServiceName", shopIdName);
//         map.put("sheetName", "销售汇总表");
//         map.put("serverTime","查询区间:"+ getRegionTime(turnCreateDate,bindCreateDate)+"        商品类别:"+getforeTypeNameStr(foreTypeName));
//         map.put("footer", "盘点人：__________        复核人：__________");
//         //map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,"","",foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "销售汇总表  -- "+DateUtil.formatterDate();
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("productName", productName);
//         params.getStringMap().put("shortCode", shortCode);
//         params.getStringMap().put("prodType", prodType);
//         params.getStringMap().put("shopName", shopName);
//         params.getStringMap().put("sortName", sortName);
//         params.getStringMap().put("sortOrder", sortOrder);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject json = ktCountService.getSellItem(params.getStringMap(),Integer.parseInt(summaryType));
//             List<Map<String, Object>> resultData = (List<Map<String, Object>>)json.get("rows");
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         if(Integer.parseInt(summaryType) == 0){
//	        List<Map<String, String>> foreAreaTypes = new ArrayList<Map<String, String>>();
//	        if(!redisService.exists("foreAreaTypes1")){
//	        	foreAreaTypes = ktCountService.findSourceArea();
//	        	redisService.set("foreAreaTypes1", foreAreaTypes, 86400L);
//	        }else{
//	        	foreAreaTypes = (List<Map<String, String>>)redisService.get("foreAreaTypes1");
//	        }
//	        String[] cols = {"QUANTITY","AMOUNT"};
//            list = getSubAreatotals(foreAreaTypes,list,cols);
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         Map<String, Object> statiticsRow = ktCountService.getStatisSellItem(Keys, params.getStringMap());
//         ShipmentInStoreList.add(statiticsRow);
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("销售汇总表",turnCreateDate,bindCreateDate,"") + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    private static List<Map<String, Object>> getSubtotals(List<Map<String, String>> foreProdTypes,List<Map<String, Object>> orgLst,String[] cols){
//    	Map<String, List<Map<String, Object>>> collections = new HashMap<String, List<Map<String, Object>>>();
//    	collections.put("99",  new LinkedList<Map<String, Object>>());
//    	for(Map<String, String> foreProdType: foreProdTypes){
//    		collections.put(foreProdType.get("TYPE_ID"), new LinkedList<Map<String, Object>>());
//        }
//    	for(Map<String, Object> o : orgLst){
//    		Object typeId = o.get("TYPE_ID");
//    		if (typeId == null) {
//    			collections.get("99").add(o);
//			}else{
//				collections.get(typeId.toString().substring(0, 2)).add(o);
//			}
//    	}
//    	Iterator<Map.Entry<String,List<Map<String, Object>>>> entries = collections.entrySet().iterator();
//    	while (entries.hasNext()) {
//			Map.Entry<String, List<Map<String, Object>>> entry = (Map.Entry<String, List<Map<String, Object>>>) entries.next();
//			if(entry.getValue().isEmpty())
//				continue;
//			List<Map<String, Object>> list = entry.getValue();
//			Map<String, Object> summation =  new HashMap<String, Object>();
//			for (int i = 0; i < list.size(); i++) {
//				Map<String, Object> oMap = list.get(i);
//				oMap.put("ROWNUM_", i+1);
//				for (int j = 0; j < cols.length; j++) {
//					summation.put(cols[j], Object2Float(summation,cols[j]) + getNumber(oMap,cols[j]));
//				}
//			}
//			if (entry.getKey().equals("99")) {
//				summation.put("ROWNUM_", "未知商品小计");
//			}else{
//				for (int i = 0; i < foreProdTypes.size(); i++) {
//					if(entry.getKey().equals(foreProdTypes.get(i).get("TYPE_ID"))){
//						summation.put("ROWNUM_", foreProdTypes.get(i).get("TYPE_NAME")+"小计");
//						break;
//					}
//				}
//			}
//			collections.get(entry.getKey()).add(summation);
//		}
//    	List<Map<String, Object>> returnlst = new LinkedList<Map<String, Object>>();
//    	for (String key : collections.keySet()) {
//    		returnlst.addAll(collections.get(key));
//		}
//    	return returnlst;
//    }
//    private static List<Map<String, Object>> getSubAreatotals(List<Map<String, String>> foreProdTypes,List<Map<String, Object>> orgLst,String[] cols){
//    	Map<String, List<Map<String, Object>>> collections = new HashMap<String, List<Map<String, Object>>>();
//    	for(Map<String, String> foreProdType: foreProdTypes){
//    		collections.put(foreProdType.get("SOURCE_AREA"), new LinkedList<Map<String, Object>>());
//        }
//    	for(Map<String, Object> o : orgLst){
//    		Object typeId = o.get("PRODUCT_TYPE");
//			collections.get(typeId.toString()).add(o);
//    	}
//    	Iterator<Map.Entry<String,List<Map<String, Object>>>> entries = collections.entrySet().iterator();
//    	int rowNum = 0;
//    	while (entries.hasNext()) {
//			Map.Entry<String, List<Map<String, Object>>> entry = (Map.Entry<String, List<Map<String, Object>>>) entries.next();
//			if(entry.getValue().isEmpty())
//				continue;
//			List<Map<String, Object>> list = entry.getValue();
//			Map<String, Object> summation =  new HashMap<String, Object>();
//			for (int i = 0; i < list.size(); i++) {
//				Map<String, Object> oMap = list.get(i);
//				for (int j = 0; j < cols.length; j++) {
//					summation.put(cols[j], Object2Float(summation,cols[j]) + getNumber(oMap,cols[j]));
//				}
//				oMap.put("ROWNUM_",++rowNum);
//			}
//			for(int i = 0;i < cols.length;i++){
//				summation.put(cols[i], String.format("%.2f", summation.get(cols[i])));
//			}
//			for (int i = 0; i < foreProdTypes.size(); i++) {
//				if(entry.getKey().equals(foreProdTypes.get(i).get("SOURCE_AREA"))){
//					summation.put("SHORT_CODE", foreProdTypes.get(i).get("SOURCE_AREA")+"小计");
//					summation.put("PARENT_ID", 0);
//					summation.put("ID", foreProdTypes.get(i).get("PRODUCT_TYPE"));
//					break;
//				}
//			}
//			collections.get(entry.getKey()).add(summation);
//		}
//    	List<Map<String, Object>> returnlst = new LinkedList<Map<String, Object>>();
//    	for (String key : collections.keySet()) {
//    		returnlst.addAll(collections.get(key));
//		}
//    	return returnlst;
//    }
//    private static float getNumber(Map<String, Object> oMap,String key){
//    	Float num = 0f;
//    	try{
//    		num = Float.valueOf(oMap.get(key).toString());
//		}catch(Exception e){
//			num = 0f;
//		}
//    	return num;
//    }
//    private static float Object2Float(Map<String, Object> oMap,String key){
//    	if(!oMap.containsKey(key)){
//    		oMap.put(key, 0);
//    	}
//    	return Float.parseFloat(oMap.get(key).toString());
//    }
//    @RequestMapping(value = "ktProdInfo")
//    public ModelAndView ktProdInfo(HttpServletRequest request){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        System.out.println("============> activeUser: "+activeUser.getRoleNo());
//        parameter.put("roleNo", activeUser.getRoleNo());
//        System.out.println("============> activeUser: "+activeUser.getUserId());
//        parameter.put("userId", activeUser.getClouderUser());
//        parameter.put("zoneCode", activeUser.getZoneCode());
//    	List<Map<String, Object>> shopName = ktCommonService.getShopList2User(parameter);
//    	mav.addObject("shopnames",shopName);
//    	mav.setViewName("content/kt/ktProdInfo");
//        return mav;
//    }
//
//    /**
//     * 获取进销存数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktProdInfo",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktProdInfo(HttpServletRequest request) throws Exception {
//    	request.setCharacterEncoding("utf-8");
//    	Long page = Long.valueOf(request.getParameter("offset"));
//    	Long pageSize = Long.valueOf(request.getParameter("limit"));
//        String filters = request.getParameter("filters");
//        String sortName = request.getParameter("sortName");
//        String orderName = request.getParameter("orderName");
///*        if(filters != null && !filters.equals("")){
//        	filters = new String (filters.getBytes("iso8859-1"),"UTF-8");
//        }*/
//        JSONObject result = null;
////        try{
//        	result = ktCountService.getKtProdInfo(page,pageSize,filters,sortName,orderName);
////        }catch(Exception e){
////        	logger.error("获取商品信息失败");
////            e.printStackTrace();
////            result = new PageDTO<>();
////        }
//        return result.toString();
//    }
//    @RequestMapping(value = "ktInOutInfo")
//    public ModelAndView ktInOutInfo(HttpServletRequest request){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        System.out.println("============> activeUser: "+activeUser.getRoleNo());
//        parameter.put("roleNo", activeUser.getRoleNo());
//        System.out.println("============> activeUser: "+activeUser.getUserId());
//        parameter.put("userId", activeUser.getClouderUser());
//        parameter.put("zoneCode", activeUser.getZoneCode());
//        System.out.println("============> parameter: "+parameter);
//    	List<Map<String, Object>> shopName = ktCommonService.getShopList2User(parameter);
//    	mav.addObject("shopnames",shopName);
//    	mav.setViewName("content/kt/ktInOut");
//        return mav;
//    }
//    @RequestMapping(value = "ktSellstock")
//    public ModelAndView ktSellstock(HttpServletRequest request){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        System.out.println("============> activeUser: "+activeUser.getRoleNo());
//        parameter.put("roleNo", activeUser.getRoleNo());
//        System.out.println("============> activeUser: "+activeUser.getUserId());
//        parameter.put("userId", activeUser.getClouderUser());
//        parameter.put("zoneCode", activeUser.getZoneCode());
//        List<Map<String, Object>> shopName = ktCommonService.getShopList2User(parameter);
//    	mav.addObject("shopnames",shopName);
//        System.out.println("============> parameter: "+parameter);
//    	mav.setViewName("content/kt/ktSellstock");
//        return mav;
//    }
//    @RequestMapping("/getktSellstocks")
//    public @ResponseBody
//    ResponseDTO getktSellstock(HttpServletRequest request) throws Exception {
//    	request.setCharacterEncoding("utf-8");
//    	Map<String, String> params = WebUtils.getAllParamMap(request);
//        String searchType = params.get("typeRadio");
//        List<Map<String, Object>> result = null;
////        try{
//        	result = ktCountService.getTOrderItemShopAllDay(params,Integer.parseInt(searchType));
////        }catch(Exception e){
////        	logger.error("获取商品信息失败");
////            e.printStackTrace();
////            result = new PageDTO<>();
////        }
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(result);
//        return responseDTO;
//    }
//
//    @RequestMapping("/exportExcelSellstocks")
//    public void exportExcelSellstocks(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	 String exportExcelData = request.getParameter("exportExcelData");
//         String turnCreateDate = request.getParameter("turnCreateDate");
//         String bindCreateDate = request.getParameter("bindCreateDate");
//         String productName = request.getParameter("productName");
//         String prodType = request.getParameter("prodType");
//         String foreTypeName = request.getParameter("foreTypeName");
//         String shopName = request.getParameter("shopName");
//         String shopIdName = request.getParameter("shopIdName");
//         String areaName = request.getParameter("areaName");
//         String supplierId = request.getParameter("supplierId");
//         String productCode = request.getParameter("productCode");
//         String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String searchType = request.getParameter("typeRadio");
//         String tbRadio = request.getParameter("tbRadio");
//         JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//         List<Map<String, Object>> ShipmentInStoreList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", "店铺商品查询 ");
//         map.put("serverTime", "时间:"+DateUtil.formatterDate());
//         map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,areaName,shopIdName,foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "店铺商品查询  -- "+DateUtil.formatterDate();
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("productName", productName);
//         params.getStringMap().put("prodType", prodType);
//         params.getStringMap().put("shopName", shopName);
//         params.getStringMap().put("supplierId", supplierId);
//         params.getStringMap().put("productCode", productCode);
//         params.getStringMap().put("tbType", tbRadio);
//         List<Map<String, Object>> list =  new LinkedList<Map<String, Object>>();
//         while (true) {
//        	 //Integer beginNum = (page - 1)* pageSize;
//        	// Integer endNum = beginNum + pageSize -1;
//             params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             List<Map<String, Object>> resultData  = ktCountService.getTOrderItemShopAllDay(params.getStringMap(),Integer.parseInt(searchType));
//             list.addAll(resultData);
//             if (resultData == null || resultData.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         ShipmentInStoreList.addAll(list);
//         logger.info("添加sheetName的Map");
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook3(ShipmentInStoreList);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("店铺商品查询",turnCreateDate,bindCreateDate,shopIdName) + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    /**
//     * 获取进销存数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktInOutInfo",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktInOutInfo(HttpServletRequest request) throws Exception {
//    	request.setCharacterEncoding("utf-8");
//    	Long page = Long.valueOf(request.getParameter("offset"));
//    	Long pageSize = Long.valueOf(request.getParameter("limit"));
//        String filters = request.getParameter("filters");
//        String sortName = request.getParameter("sortName");
//        String orderName = request.getParameter("orderName");
///*        if(filters != null && !filters.equals("")){
//        	filters = new String (filters.getBytes("iso8859-1"),"UTF-8");
//        }*/
//        JSONObject result = null;
////        try{
//        	result = ktCountService.getKtInOutInfo(page,pageSize,filters,sortName,orderName);
////        }catch(Exception e){
////        	logger.error("获取商品信息失败");
////            e.printStackTrace();
////            result = new PageDTO<>();
////        }
//        return result.toString();
//    }
//
//    @RequestMapping("/exportExcelInOutInfo")
//    public void exportExcelInOutInfo(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	String exportExcelData = request.getParameter("exportExcelData");
//    	 String supplierName = request.getParameter("supplierName");
//    	 String shopName = request.getParameter("shopName");
//    	 String shopIdName = request.getParameter("shopIdName");
//    	 String prodType = request.getParameter("prodType");
//    	 String foreTypeName = request.getParameter("foreTypeName");
//    	 String productName = request.getParameter("productName");
//    	 String productCode = request.getParameter("productCode");
//    	 String helpCode = request.getParameter("helpCode");
//    	 String type = request.getParameter("type");
//    	 String turnCreateDate = request.getParameter("turnCreateDate");
//    	 String bindCreateDate = request.getParameter("bindCreateDate");
//    	 String areaName= request.getParameter("areaName");
//    	 String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String sortName = request.getParameter("sortName");
//         String orderName = request.getParameter("orderName");
//    	 JSONArray filters = new JSONArray();
//    	 if (shopName!=null && !"".equals(shopName)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "z.SHOP_ID");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+shopName+")");
//    		 filters.add(json);
//    	 }
//    	 if (supplierName!=null && !"".equals(supplierName)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "sp.SUPPLIER_ID");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+supplierName+")");
//    		 filters.add(json);
//    	 }
//    	 if (prodType!=null && !"".equals(prodType)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "t.TYPE_ID");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+prodType+")");
//    		 filters.add(json);
//    	 }
//    	 if (productName!=null && !"".equals(productName)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "p.PRODUCT_NAME");
//    		 json.accumulate("ft", "like");
//    		 json.accumulate("fv", "'%"+productName+"%'");
//    		 filters.add(json);
//    	 }
//    	 if (productCode!=null && !"".equals(productCode)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "p.PRODUCT_CODE");
//    		 json.accumulate("ft", "like");
//    		 json.accumulate("fv", "'%"+productCode+"%'");
//    		 filters.add(json);
//    	 }
//    	 if (helpCode!=null && !"".equals(helpCode)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "p.HELP_CODE");
//    		 json.accumulate("ft", "like");
//    		 json.accumulate("fv", "'%"+helpCode+"%'");
//    		 filters.add(json);
//    	 }
//    	 if (type!=null && !"".equals(type)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "ttt.TYPE");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+type+")");
//    		 filters.add(json);
//    	 }
//    	 if (turnCreateDate!=null && !"".equals(turnCreateDate)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "ttt.STATE_DATE");
//    		 json.accumulate("ft", ">=");
//    		 json.accumulate("fv", "to_date('"+turnCreateDate+"','yyyy-MM-dd hh24:mi:ss')");
//    		 filters.add(json);
//    	 }
//    	 if (bindCreateDate!=null && !"".equals(bindCreateDate)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "ttt.STATE_DATE");
//    		 json.accumulate("ft", "<=");
//    		 json.accumulate("fv", "to_date('"+bindCreateDate+"','yyyy-MM-dd hh24:mi:ss')");
//    		 filters.add(json);
//    	 }
//         List<Map<String, Object>> ShipmentInStoreList = new LinkedList<Map<String, Object>>();
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", "出入库明细报表 ");
//         map.put("serverTime", "时间:"+DateUtil.formatterDate());
//         map.put("authorTime",getAuthorTime(activeUser.getUsername(),turnCreateDate,bindCreateDate,areaName,shopIdName,foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "出入库明细报表  -- "+DateUtil.formatterDate();
//
//         while (true) {
//        	 Integer beginNum = (page - 1)* pageSize;
//        	 Integer endNum = beginNum + pageSize;
//             JSONObject resultData = ktCountService.getKtInOutInfo(Long.valueOf(page),Long.valueOf(pageSize),filters.toString(),sortName,orderName);
//             List<Map<String, Object>> result = (List<Map<String, Object>>) resultData.get("rows");
//             ShipmentInStoreList.addAll(result);
//             if (result == null || result.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         logger.info("添加sheetName的Map");
//         Map<String, Object> statiticsRow = ktCountService.getStatisInOut(Keys, filters.toString());
//         ShipmentInStoreList.add(statiticsRow);
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("出入库明细报表",turnCreateDate,bindCreateDate,shopIdName) + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    @RequestMapping(value = "getAreas",method= RequestMethod.POST)
//    public @ResponseBody
//    ResponseDTO getAreas(HttpServletResponse response) throws UnsupportedEncodingException{
//    	response.setContentType("text/html;charset=UTF-8");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        Map<String,String> parameter = new HashMap<String, String>();
//        parameter.put("zoneCode", activeUser.getZoneCode());
//    	List<Map<String, Object>> orginAreas = ktCommonService.getZoneList2User(parameter);
//    	ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(orginAreas);
//    	return responseDTO;
//    }
//    @RequestMapping(value = "getProdTypes",method= RequestMethod.POST)
//    public @ResponseBody
//    ResponseDTO getProdTypes(HttpServletResponse response) throws UnsupportedEncodingException{
//    	response.setContentType("text/html;charset=UTF-8");
//    	Subject subject = SecurityUtils.getSubject();
//        List<Map<String, String>> prodType = ktCountService.findProductType(null);
//    	ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(prodType);
//    	return responseDTO;
//    }
//    @RequestMapping(value = "getSuppliers",method= RequestMethod.POST)
//    public @ResponseBody
//    ResponseDTO getSuppliers(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException{
//    	response.setContentType("text/html;charset=UTF-8");
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	String typeId = parameter.get("typeId");
//        List<Map<String, String>> prodType = ktCountService.findSupplierName(typeId);
//    	ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(prodType);
//    	return responseDTO;
//    }
//
//    @RequestMapping(value = "getShops",method= RequestMethod.POST)
//    public @ResponseBody
//    ResponseDTO getShops(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException{
//    	response.setContentType("text/html;charset=UTF-8");
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        parameter.put("roleNo", activeUser.getRoleNo());
//        parameter.put("userId", activeUser.getClouderUser());
//    	List<Map<String, Object>> shopName = ktCommonService.getShopList2ZoneUser(parameter);
//    	ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(shopName);
//    	return responseDTO;
//    }
//
//    @RequestMapping(value = "getClerks",method= RequestMethod.POST)
//    public @ResponseBody
//    ResponseDTO getClerks(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException{
//    	response.setContentType("text/html;charset=UTF-8");
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	List<Map<String, Object>> clerks = ktCountService.getClerks(parameter);
//    	ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(clerks);
//    	return responseDTO;
//    }
//    @RequestMapping(value = "ktCollectMoney")
//    public ModelAndView ktCollectMoney(HttpServletRequest request){
//    	ModelAndView mav = new ModelAndView();
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	mav.setViewName("content/kt/ktCollectMoney");
//        return mav;
//    }
//    @RequestMapping("/exportExcelCollectMoney")
//    public void exportExcelCollectMoney(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	String exportExcelData = request.getParameter("exportExcelData");;
//    	 String operator = request.getParameter("operator");
//    	 String shopId = request.getParameter("shopId");
//    	 String shopIdName = request.getParameter("shopIdName");
//    	 String turnCreateDate = request.getParameter("turnCreateDate");
//    	 String bindCreateDate = request.getParameter("bindCreateDate");
//    	 String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String searchType = request.getParameter("searchTypeRadio");
//         String sortName = request.getParameter("sortName");
//         String order = request.getParameter("order");
//
//         params.getStringMap().put("turnCreateDate", turnCreateDate);
//         params.getStringMap().put("bindCreateDate", bindCreateDate);
//         params.getStringMap().put("shopId", shopId);
//         params.getStringMap().put("operator", operator);
//         params.getStringMap().put("sortName", sortName);
//         params.getStringMap().put("sortOrder", order);
//         List<Map<String, Object>> ShipmentInStoreList = new LinkedList<Map<String, Object>>();
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("areaServiceName", shopIdName);
//         map.put("sheetName", "收银日报表");
//         map.put("serverTime", "时间:"+DateUtil.formatterDate("yyyy-MM-dd HH:mm:ss"));
//         map.put("footer", "盘点人：__________        复核人：__________");
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "收银日报表  -- "+DateUtil.formatterDate();
//
//         while (true) {
//        	 params.getStringMap().put("offset", page.toString());
//             params.getStringMap().put("limit", pageSize.toString());
//             JSONObject resultData = ktCountService.getKtCollectMoney(params.getStringMap(),Integer.parseInt(searchType));
//             List<Map<String, Object>> result = (List<Map<String, Object>>) resultData.get("rows");
//             ShipmentInStoreList.addAll(result);
//             if (result == null || result.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         logger.info("添加sheetName的Map");
//         Map<String, Object> statiticsRow = ktCountService.getStatisCollectMoney(Keys, params.getStringMap(), Integer.parseInt(searchType));
//         ShipmentInStoreList.add(statiticsRow);
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("收银日报表",turnCreateDate,bindCreateDate,"") + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//    private static String getFileName(String fileName,String startTime,String endTime,String shopName){
//    	String timeDate = "";
//    	if ((startTime != null && !startTime.equals(""))||(endTime != null && !endTime.equals(""))) {
//    		if(startTime == null || startTime.equals("")){
//    			timeDate = "至"+DateUtil.formatterDate(endTime, "yyyy-MM-dd");
//    		}else if(endTime == null || endTime.equals("")){
//    			timeDate = DateUtil.formatterDate(startTime, "yyyy-MM-dd")+"至"+DateUtil.formatterDate("yyyy-MM-dd");
//    		}else{
//    			if(DateUtil.formatterDate(startTime, "yyyy-MM-dd") == DateUtil.formatterDate(endTime, "yyyy-MM-dd")){
//    				timeDate = DateUtil.formatterDate(startTime, "yyyy-MM-dd");
//    			}else{
//    				timeDate = DateUtil.formatterDate(startTime, "yyyy-MM-dd")+"至"+DateUtil.formatterDate(endTime, "yyyy-MM-dd");
//    			}
//    		}
//
//		}
//    	return shopName+timeDate+fileName;
//    }
//    private static String getRegionTime(String startTime,String endTime){
//    	String timeDate = "";
//    	if ((startTime != null && !startTime.equals(""))||(endTime != null && !endTime.equals(""))) {
//    		if(startTime == null || startTime.equals("")){
//    			timeDate += "至"+DateUtil.formatterDate(endTime, "yyyy-MM-dd");
//    		}else if(endTime == null || endTime.equals("")){
//    			timeDate += DateUtil.formatterDate(startTime, "yyyy-MM-dd")+"至"+DateUtil.formatterDate("yyyy-MM-dd");
//    		}else{
//    			if(DateUtil.formatterDate(startTime, "yyyy-MM-dd") == DateUtil.formatterDate(endTime, "yyyy-MM-dd")){
//    				timeDate += DateUtil.formatterDate(startTime, "yyyy-MM-dd");
//    			}else{
//    				timeDate += DateUtil.formatterDate(startTime, "yyyy-MM-dd")+"至"+DateUtil.formatterDate(endTime, "yyyy-MM-dd");
//    			}
//    		}
//
//		}else{
//			timeDate += "至"+DateUtil.formatterDate("yyyy-MM-dd");
//		}
//
//    	return timeDate;
//    }
//    private static String getforeTypeNameStr(String foreTypeName){
//    	String foreTypeNameStr = "";
//    	if(foreTypeName ==null || foreTypeName.equals("")){
//    		foreTypeNameStr += "全部";
//    	}else{
//    		foreTypeNameStr += foreTypeName;
//    	}
//    	return foreTypeNameStr;
//    }
//    private static String getAuthorTime(String username,String startTime,String endTime,String areaNameStr,String shopName,String foreTypeName){
//    	String areaName = "";
//    	if(username == null || username.equals("")){
//    		username = "无名";
//    	}
//    	if (areaNameStr != null && !areaNameStr.equals("")) {
//    		String[] areaNames = areaNameStr.split(",");
//    		if(areaNames.length > 1){
//    			areaName = "多区域|";
//    		}else{
//    			areaName = areaNameStr+"|";
//    		}
//		}
//    	if(shopName != null && !shopName.equals("")){
//    		shopName = shopName+"|";
//    	}
//    	if(foreTypeName != null && !foreTypeName.equals("")){
//    		foreTypeName = "类别["+foreTypeName+"]|";
//    	}
//    	if(startTime == null || startTime.equals("")){
//    		startTime = "1900/1/1";
//    	}else{
//    		startTime = DateUtil.formatterDate(startTime, "yyyy/MM/dd");
//    	}
//    	if(endTime == null || endTime.equals("")){
//    		endTime = DateUtil.formatterDate("yyyy/MM/dd");
//    	}else{
//    		endTime = DateUtil.formatterDate(endTime, "yyyy/MM/dd");
//    	}
//    	return username+":"+areaName+shopName+foreTypeName+startTime+"~"+endTime;
//    }
//    /**
//     * 获取进销存数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktCollectMoney",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktCollectMoney(HttpServletRequest request) throws Exception {
//    	request.setCharacterEncoding("utf-8");
//    	Map<String, String> params = WebUtils.getAllParamMap(request);
//        String searchType = params.get("searchTypeRadio");
//
//        JSONObject result = null;
////        try{
//        	result = ktCountService.getKtCollectMoney(params,Integer.parseInt(searchType));
////        }catch(Exception e){
////        	logger.error("获取商品信息失败");
////            e.printStackTrace();
////            result = new PageDTO<>();
////        }
//        return result.toString();
//    }
//
//
//    /**
//     * 获取资金缴存对账数据
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/ktMoneyPaysave",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktMoneyPaysave(HttpServletRequest request) throws Exception {
//    	request.setCharacterEncoding("utf-8");
//    	Long offset = Long.valueOf(request.getParameter("offset"));
//    	Long limit = Long.valueOf(request.getParameter("limit"));
//        String filters = request.getParameter("filters");
//        String searchType = request.getParameter("searchTypeRadio");
//        String sortName = request.getParameter("sortName");
//        String order = request.getParameter("order");
//        JSONObject result = null;
//        	result = ktCountService.ktMoneyPaysave(offset,limit,filters,Integer.parseInt(searchType),sortName,order);
//
//        return result.toString();
//    }
//
//    /**
//     * 进销存报表1
//     * @return
//     */
//    @RequestMapping(value = "invoicingReport")
//    public String invoicingReport(){
//        return "content/kt/invoicingReport";
//    }
//    @RequestMapping("/exportExcelProdInfo")
//    public void exportExcelProdInfo(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception{
//    	logger.info("开始生成excel表格");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//    	String exportExcelData = request.getParameter("exportExcelData");
//    	 String supplierName = request.getParameter("supplierName");
//    	 String prodType = request.getParameter("prodType");
//    	 String foreTypeName = request.getParameter("foreTypeName");
//    	 String productName = request.getParameter("productName");
//    	 String productCode = request.getParameter("productCode");
//    	 String helpCode = request.getParameter("helpCode");
//    	 String rtlPrice = request.getParameter("rtlPrice");
//    	 String srtlPrice = request.getParameter("srtlPrice");
//    	 Object shopName = request.getParameter("shopName");
//    	 String shopIdName = request.getParameter("shopIdName");
//    	 String colsTitles = request.getParameter("colsTitles");
//         String colsFields = request.getParameter("colsFields");
//         String sortName = request.getParameter("sortName");
//         String orderName = request.getParameter("orderName");
//         JSONArray filters = new JSONArray();
//    	 if (shopName!=null && !"".equals(shopName)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "ssp.SHOP_ID");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+shopName+")");
//    		 filters.add(json);
//    	 }
//    	 if (supplierName!=null && !"".equals(supplierName)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "sp.SUPPLIER_ID");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+supplierName+")");
//    		 filters.add(json);
//    	 }
//    	 if (prodType!=null && !"".equals(prodType)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "t.TYPE_ID");
//    		 json.accumulate("ft", "in");
//    		 json.accumulate("fv", "("+prodType+")");
//    		 filters.add(json);
//    	 }
//    	 if (productCode!=null && !"".equals(productCode)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "p.PRODUCT_CODE");
//    		 json.accumulate("ft", "like");
//    		 json.accumulate("fv", "'%"+productCode+"%'");
//    		 filters.add(json);
//    	 }
//    	 if (productName!=null && !"".equals(productName)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "p.PRODUCT_NAME");
//    		 json.accumulate("ft", "like");
//    		 json.accumulate("fv", "'%"+productName+"%'");
//    		 filters.add(json);
//    	 }
//    	 if (helpCode!=null && !"".equals(helpCode)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "p.HELP_CODE");
//    		 json.accumulate("ft", "like");
//    		 json.accumulate("fv", "'%"+helpCode+"%'");
//    		 filters.add(json);
//    	 }
//    	 if (rtlPrice!=null && !"".equals(rtlPrice)) {
//    		 JSONObject  json = new JSONObject();
//    		 json.accumulate("fn", "p.RTL_PRICE");
//    		 json.accumulate("ft", srtlPrice);
//    		 json.accumulate("fv", "'"+rtlPrice+"'");
//    		 filters.add(json);
//    	 }
//
//         List<Map<String, Object>> ShipmentInStoreList = new LinkedList<Map<String, Object>>();
//         logger.info("json转List完毕");
//         Map<String, Object> map = new HashMap<>();
//
//         String[] Keys = new String[0];
//         String[] columnNames = new String[0];
//
//         Integer page = 0;
//         Integer pageSize = 10000;
//
//         ShipmentInStoreList.clear();
//         map.put("sheetName", "商品库存盘点表 ");
//         map.put("serverTime", "时间:"+DateUtil.formatterDate());
//         map.put("authorTime",getAuthorTime(activeUser.getUsername(),"","","",shopIdName,foreTypeName));
//         Keys = String2Array(colsFields);
//         columnNames = String2Array(colsTitles);
//         String fileName = "商品查询表  -- "+DateUtil.formatterDate();
//
//         while (true) {
//        	 Integer beginNum = (page - 1)* pageSize;
//        	 Integer endNum = beginNum + pageSize;
//             JSONObject resultData = ktCountService.getKtProdInfo(Long.valueOf(page),Long.valueOf(pageSize),filters.toString(),sortName,orderName);
//             List<Map<String, Object>> result = (List<Map<String, Object>>) resultData.get("rows");
//             ShipmentInStoreList.addAll(result);
//             if (result == null || result.size() < pageSize) {
//                 break;
//             }
//             page+=pageSize;
//         }
//         logger.info("添加sheetName的Map");
//         ShipmentInStoreList.add(0, map);
//         logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//         HSSFWorkbook wb;
//         try {
//             wb = ExcelUtil.createHSSFWorkbook2(ShipmentInStoreList, Keys, columnNames);
//         }catch (IllegalArgumentException e) {
//             e.printStackTrace();
//             throw new CustomException("数据实在太大，建议分多次导出");
//         }
//
//         logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//         OutputStream out = response.getOutputStream();
//         response.reset();
//         response.setHeader("Content-Disposition", "attachment;filename=" + new String((getFileName("商品查询表",null,null,shopIdName) + ".xls").getBytes(), "iso-8859-1"));
//         response.setContentType("application/msexcel;charset=UTF-8");
//         logger.info("设置响应信息完成");
//         //输出excel文件
//         wb.write(out);
//         out.close();
//         logger.info("结束生成excel表格");
//    }
//
//
//
//    /**
//     * 统计数据导出到excel
//     *
//     * @param request
//     * @param response
//     * @throws Exception
//     */
//    @RequestMapping("/exportExcel")
//    public void exportExcel(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception {
//        logger.info("开始生成excel表格");
//        String exportExcelData = request.getParameter("exportExcelData");
//        String turnCreateDate = request.getParameter("turnCreateDate");
//        String bindCreateDate = request.getParameter("bindCreateDate");
//        String shopId = request.getParameter("shopId");
//        String supplierId = request.getParameter("supplierId");
//        String tableType = request.getParameter("tableType");
//        if (tableType == null) {
//            throw new CustomException("表格数据太大");
//        }
//
//        JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//        List<Map<String, Object>> ShipmentOrderList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//        logger.info("json转List完毕");
//        Map<String, Object> map = new HashMap<>();
//        logger.info("tableType is : " + tableType);
//
//        String[] Keys = new String[0];
//        String[] columnNames = new String[0];
//
//        String fileName = "";
//
//        // 对用户角色权限进行分析处理
////        Subject subject = SecurityUtils.getSubject();
////        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
////        params.getStringMap().put("channelCode", activeUser.getChannelName());
////
////        String quXianName = params.getStringMap().get("quXianName");
////
////        if (StringUtils.isNot_NullOrTrimEmpty(activeUser.getEmpName())){
////            params.getStringMap().put("empName", activeUser.getEmpName());
////        }
////
////        if (!StringUtils.isNullOrTrimEmpty(activeUser.getQuXianName())) {
////            quXianName = activeUser.getQuXianName();
////        }
////
////        if (!StringUtils.isNullOrTrimEmpty(quXianName)) {
////            String channelId = sPLOrderService.getIdByChannleName(quXianName);
////            params.getStringMap().put("parentChannelId", channelId == null ? "-99999" : channelId);
////        }
//
////        String channelName = activeUser.getRealChannelName();
////        if (!StringUtils.isNullOrTrimEmpty(channelName)) {
////            params.getStringMap().put("channelName", channelName);
////        }
//
//        //获取导出数据
//        Integer pages = 1;
//        Integer pageSizes = 10000;
//        //根据导出类型获取导出数据
//        switch (tableType) {
//            case "shipmentOrder": //门店销售汇总数据
//                ShipmentOrderList.clear();
//                map.put("sheetName", "扫码出货统计");
//                Keys = new String[]{"id","shopName", "barCode", "prodName", "quantity","price", "quantityPrice", "benefitPrice", "amt", "benefitAmt", "price", "username",  "customerPhone","operatorTime"};//"mobile","id", "channelName","totalPrice",
//                columnNames = new String[]{"订单编号","店铺名称", "商品编号",  "商品名称", "销量","销售价格","单品金额","优惠价格", "订单金额", "订单优惠额", "商品单价", "操作人", "消费者电话","操作时间"};// "电话号码","订单编号", "渠道名称", "订单总价",
//                fileName = "门店销售汇总数据";
//
//                //获取导出数据
//                addShipmentOrderList(ShipmentOrderList, params.getStringMap());
//
//                break;
//
//            case "ktCollect": //采购汇总数据
//                ShipmentOrderList.clear();
//                map.put("sheetName", "采购汇总数据");
//                Keys = new String[]{"SUPPLIER_ID", "SUPPLIER_NAME", "AMTIN","AMTBACK","FACTAMT"};
//                columnNames = new String[]{"供应商ID","供应商名称","进货金额","退货金额","实际金额",};
//                fileName = "采购汇总数据";
//
//                params.getStringMap().put("turnCreateDate", turnCreateDate);
//                params.getStringMap().put("bindCreateDate", bindCreateDate);
////                params.getStringMap().put("shopId", shopId);
//                params.getStringMap().put("supplierId", supplierId);
//                params.getStringMap().put("pageSize", pageSizes.toString());
//                while (true) {
//                    params.getStringMap().put("page", pages.toString());
//                    List<Map<String, Object>> resultData = ktCountService.getKtCollect(params.getStringMap());
//                    ShipmentOrderList.addAll(resultData);
//                    if (resultData == null || resultData.size() < pageSizes) {
//                        break;
//                    }
//                    pages++;
//                }
//                break;
//            case "ktInsCargo": //采购数据
//                ShipmentOrderList.clear();
//                map.put("sheetName", "采购进货数据");
//                Keys = new String[]{"REPERTORY_ID", "SHOP_NAME", "SUPPLIER_ID", "SUPPLIER_NAME", "PRODUCT_CODE", "PRODUCT_NAME", "SPEC","UNIT","CST_PRICE","RTL_PRICE","REAL_QUANTITY", "AMT"};
//                columnNames = new String[]{"店铺编号","店铺名称","供应商编号","供应商名称","商品条码","商品名称","规格","单位","进价","零售价","进货数量","金额",};
//                fileName = "采购进货数据";
//
//                params.getStringMap().put("turnCreateDate", turnCreateDate);
//                params.getStringMap().put("bindCreateDate", bindCreateDate);
//                params.getStringMap().put("shopId", shopId);
//                params.getStringMap().put("supplierId", supplierId);
//                params.getStringMap().put("pageSize", pageSizes.toString());
//                while (true) {
//                    params.getStringMap().put("page", pages.toString());
//                    List<Map<String, Object>> resultData = ktCountService.getKtInsCargo(params.getStringMap());
//                    ShipmentOrderList.addAll(resultData);
//                    if (resultData == null || resultData.size() < pageSizes) {
//                        break;
//                    }
//                    pages++;
//                }
//                break;
//            case "ktOutCargo": //退货数据
//                ShipmentOrderList.clear();
//                map.put("sheetName", "采购退货数据");
//                Keys = new String[]{"REPERTORY_ID", "SHOP_NAME", "SUPPLIER_ID", "SUPPLIER_NAME", "PRODUCT_CODE", "PRODUCT_NAME", "SPEC", "UNIT","CST_PRICE","REAL_QUANTITY", "AMT"};
//                columnNames = new String[]{"店铺编号","店铺名称","供应商编号","供应商名称","商品条码","商品名称","规格","单位","零售价","退货数量","金额",};
//                fileName = "采购退货数据";
//
//                params.getStringMap().put("turnCreateDate", turnCreateDate);
//                params.getStringMap().put("bindCreateDate", bindCreateDate);
//                params.getStringMap().put("shopId", shopId);
//                params.getStringMap().put("supplierId", supplierId);
//                params.getStringMap().put("pageSize", pageSizes.toString());
//                while (true) {
//                    params.getStringMap().put("page", pages.toString());
//                    List<Map<String, Object>> resultData = ktCountService.getKtOutCargo(params.getStringMap());
//                    ShipmentOrderList.addAll(resultData);
//                    if (resultData == null || resultData.size() < pageSizes) {
//                        break;
//                    }
//                    pages++;
//                }
//                break;
//        }
//        logger.info("添加sheetName的Map");
//        ShipmentOrderList.add(0, map);
//        logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//        HSSFWorkbook wb;
//        try {
//            wb = ExcelUtil.createHSSFWorkbook2(ShipmentOrderList, Keys, columnNames);
//        }catch (IllegalArgumentException e) {
//            e.printStackTrace();
//            throw new CustomException("数据实在太大，建议分多次导出");
//        }
//
//        logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//        OutputStream out = response.getOutputStream();
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes(), "iso-8859-1"));
//        response.setContentType("application/msexcel;charset=UTF-8");
//        logger.info("设置响应信息完成");
//        //输出excel文件
//        wb.write(out);
//        out.close();
//        logger.info("结束生成excel表格");
//    }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//    /**
//     * 卷烟订购导出到excel
//     *
//     * @param request
//     * @param response
//     * @throws Exception
//     */
//    @RequestMapping("/exportTobaccoExcels")
//    public void exportExcels(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception {
//        logger.info("开始生成excel表格");
//        String exportExcelData = request.getParameter("exportExcelData");
//        String shopName = request.getParameter("shopName");
//        String shopType = request.getParameter("shopType");
//        String shopId = request.getParameter("shopId");;
//        String tableType = request.getParameter("tableType");
//        if (tableType == null) {
//            throw new CustomException("表格数据太大");
//        }
//        logger.info("exportExcelData is "+exportExcelData);
//        JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//        List<Map<String, Object>> ShipmentOrderList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//        logger.info("json转List完毕");
//        Map<String, Object> map = new HashMap<>();
//        logger.info("tableType is : " + tableType);
//
//        String[] Keys = new String[0];
//        String[] columnNames = new String[0];
//
//        Integer page = 1;
//        Integer pageSize = 6000;
//        String fileName = "";
//        //根据导出类型获取导出数据
//        switch (tableType) {
//
//            case "stock": //商品库存
//                ShipmentOrderList.clear();
//                map.put("sheetName", "卷烟订购表");
//                Keys = new String[]{"productName", "quantity","productStatus", "specType", "seasonType", "stockMinDay", "stockMaxDay", "monthSales" ,"dailySales" ,"unitStock", "stock", "orderStatus", "systemRecommendQuantity", "systemRecommendUnitQuantity", "shopReccomendUnitQuantity", "zoneCheckQuantity", "confirmQuantity", "actualQuantity", "remark"};
//                columnNames = new String[]{"货品名称", "规格", "商品状态", "品规类别", "季节类别", "下限", "上限", "月销量(条)", "日均销量(天/包)", "库存值(条)", "库存值(包)", "订货状态", "系统建议订货包数" , "系统建议订货条数", "门店建议订购条数", "区域审核订购量", "确认订购", "实际订购", "备注"};
//                fileName = "卷烟订购表";
//
//                //获取导出数据
//                params.getStringMap().put("shopName", shopName);
//                params.getStringMap().put("shopType", shopType);
//                params.getStringMap().put("shopId", shopId);
//                params.getStringMap().put("pageSize", pageSize.toString());
//                while (true) {
//                    params.getStringMap().put("page", page.toString());
//                    PageDTO<Map<String, Object>> dto = shopService.exportKtTobaccoOrder(params.getStringMap());
//                    List<Map<String, Object>> resultData = dto.getRecordList();
//                    ShipmentOrderList.addAll(resultData);
//                    if (resultData == null || resultData.size() < pageSize) {
//                        break;
//                    }
//                    page++;
//                }
//                break;
//            case "sellwell": //
//
//                String shopIds = request.getParameter("exportExcelshopIds");
//                String shortNames = request.getParameter("exportExcelshortshortNames");
//                String shopIdNames = request.getParameter("exportExcelshortshopIdNames");
//                String year = request.getParameter("exportExcelYear");
//                String weekNo = request.getParameter("exportExcelWeekNo");
//
//                ShipmentOrderList.clear();
//                map.put("sheetName", "紧缺烟审批");
//
//                String shortName = "商品/店铺," + shortNames;
//
//
//                Keys = shortName.split(",");
//                columnNames = shortName.split(",");
//                fileName = "紧缺烟审批"+year+"年"+weekNo+"周";
//
//                //获取导出数据
//                params.getStringMap().put("year", year);
//                params.getStringMap().put("weekNo", weekNo);
//                params.getStringMap().put("shopIds", shopIds);
//                params.getStringMap().put("shopIdNames", shopIdNames);
//                while (true) {
//                    params.getStringMap().put("page", page.toString());
//                    List<Map<String, Object>> resultData = ktCountService.tablesToExcel(params.getStringMap());
//                    ShipmentOrderList.addAll(resultData);
//                    if (resultData == null || resultData.size() < pageSize) {
//                        break;
//                    }
//                    page++;
//                }
//                break;
//        }
//        logger.info("添加sheetName的Map");
//        ShipmentOrderList.add(0, map);
//        logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//        HSSFWorkbook wb;
//        try {
//            wb = ExcelUtil.createHSSFWorkbook2(ShipmentOrderList, Keys, columnNames);
//        }catch (IllegalArgumentException e) {
//            e.printStackTrace();
//            throw new CustomException("数据实在太大，建议分多次导出");
//        }
//
//        logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//        OutputStream out = response.getOutputStream();
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes(), "iso-8859-1"));
//        response.setContentType("application/msexcel;charset=UTF-8");
//        logger.info("设置响应信息完成");
//        //输出excel文件
//        wb.write(out);
//        out.close();
//        logger.info("结束生成excel表格");
//    }
//
//    /**
//     * 店铺卷烟申购列表
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/getKtTobaccoOrder")
//    public
//    @ResponseBody
//    ResponseDTO getKtTobaccoOrder(HttpServletRequest request, HttpServletResponse response) {
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//        List<Map<String, Object>> result = ktCountService.getKtTobaccoOrder(parameter);
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setCode("200");
//        responseDTO.setSuccess(true);
//        responseDTO.setData(result);
//        responseDTO.setMessage("操作成功");
//    	return responseDTO;
//    }
//
//    /**
//     * 保存店铺卷烟订购
//     *
//     * @param request
//     * @param response
//     * @return json
//     */
//    @RequestMapping("/saveKtTobaccoOrder")
//    public
//    @ResponseBody
//    ResponseDTO saveKtTobaccoOrder(HttpServletRequest request, HttpServletResponse response) {
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String,String> parameter = WebUtils.getAllParamMap(request);
//        try {
//        	Subject subject = SecurityUtils.getSubject();
//            ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//            parameter.put("operator", activeUser.getUserId());
//            ktCountService.saveKtTobaccoOrder(parameter);
//            responseDTO.setCode("200");
//            responseDTO.setSuccess(true);
//            responseDTO.setMessage("操作成功");
//        } catch (Exception e) {
//            e.printStackTrace();
//            responseDTO.setCode("500");
//            responseDTO.setMessage("服务器异常");
//        }
//        return responseDTO;
//
//    }
//
//
//    @RequestMapping("/saveSingleKtTobaccoOrder")
//    public
//    @ResponseBody
//    ResponseDTO saveSingleKtTobaccoOrder(HttpServletRequest request, HttpServletResponse response) {
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String,String> parameter = WebUtils.getAllParamMap(request);
//        try {
//        	Subject subject = SecurityUtils.getSubject();
//            ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//            parameter.put("operator", activeUser.getUserId());
//            ktCountService.saveSingleKtTobaccoOrder(parameter);
//            responseDTO.setCode("200");
//            responseDTO.setSuccess(true);
//            responseDTO.setMessage("操作成功");
//        } catch (Exception e) {
//            e.printStackTrace();
//            responseDTO.setCode("500");
//            responseDTO.setMessage("服务器异常");
//        }
//        return responseDTO;
//
//    }
//
//    /**
//     * 店铺卷烟申购列表
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/getXYShopTobacco")
//    public
//    @ResponseBody
//    ResponseDTO getXYShopTobacco(HttpServletRequest request, HttpServletResponse response) {
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//        Map<String, Object> result = ktCountService.getXYShopTobacco(parameter);
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setCode("200");
//        responseDTO.setSuccess(true);
//        responseDTO.setData(result);
//        responseDTO.setMessage("操作成功");
//    	return responseDTO;
//    }
//
//    /**
//     * 保存店铺卷烟订购
//     *
//     * @param request
//     * @param response
//     * @return json
//     */
//    @RequestMapping("/saveShopTobaccoRequirement")
//    public
//    @ResponseBody
//    ResponseDTO saveShopTobaccoRequirement(HttpServletRequest request, HttpServletResponse response) {
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String,String> parameter = WebUtils.getAllParamMap(request);
//        try {
//        	Subject subject = SecurityUtils.getSubject();
//            ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//            parameter.put("operator", activeUser.getUserId());
//            ktCountService.saveShopTobaccoRequirement(parameter);
//            responseDTO.setCode("200");
//            responseDTO.setSuccess(true);
//            responseDTO.setMessage("操作成功");
//        } catch (Exception e) {
//            e.printStackTrace();
//            responseDTO.setCode("500");
//            responseDTO.setMessage("服务器异常");
//        }
//        return responseDTO;
//    }
//
//    @RequestMapping("/getShopStockOrSales")
//    public
//    @ResponseBody
//    ResponseDTO getShopStockOrSales(HttpServletRequest request, HttpServletResponse response) {
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//        Map<String, Object> result = ktCountService.getShopStockOrSales(parameter);
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setCode("200");
//        responseDTO.setSuccess(true);
//        responseDTO.setData(result);
//        responseDTO.setMessage("操作成功");
//    	return responseDTO;
//    }
//
//
//    /**
//     * 销售汇总查询
//     */
//    @RequestMapping(value = "/salesSummaryList",produces = "application/json; charset=UTF-8")
//    @ResponseBody
//    public String salesSummaryList(HttpServletRequest request, HttpServletResponse response){
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//         result = ktCountService.salesSummaryList(parameter);
//    	return result.toString();
//    }
//
//    /**
//     * 查询区域
//     */
//    @RequestMapping(value = "/getArea",produces = "application/json; charset=UTF-8")
//    @ResponseBody
//    public JSONArray getArea(HttpServletRequest request, HttpServletResponse response){
//        Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	JSONObject result = ktCountService.getArea(parameter);
//    	Object object = result.get("rows");
//    	JSONArray jsonArray = JSONArray.fromObject(object);
//    	return jsonArray;
//
//    	/*response.setContentType("text/html;charset=UTF-8");
//    	Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        Map<String,String> parameter = new HashMap<String, String>();
//        parameter.put("zoneCode", activeUser.getZoneCode());
//    	List<Map<String, Object>> orginAreas = ktCommonService.getZoneList2User(parameter);
//		return JSONArray.fromObject(orginAreas);*/
//    }
//
//    /**
//     * 查询店铺
//     */
//    @RequestMapping("/getShop")
//    @ResponseBody
//    public JSONArray getShop(HttpServletRequest request, HttpServletResponse response){
//        Map<String,String> parameter = WebUtils.getAllParamMap(request);
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        parameter.put("roleNo", activeUser.getRoleNo());
//        parameter.put("userId", activeUser.getClouderUser());
//        if("27".equals(activeUser.getRoleNo())){
//            parameter.put("zoneCode", activeUser.getZoneCode());
//        }
//    	JSONObject result = ktCountService.getShop(parameter);
//    	Object shops = result.get("shops");
//    	JSONArray shopArray = JSONArray.fromObject(shops);
//    	return shopArray;
//
//
////    	response.setContentType("text/html;charset=UTF-8");
////    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
////    	Subject subject = SecurityUtils.getSubject();
////        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
////        System.out.println("============> activeUser: "+activeUser.getRoleNo());
////        parameter.put("roleNo", activeUser.getRoleNo());
////        System.out.println("============> activeUser: "+activeUser.getUserId());
////        parameter.put("userId", activeUser.getClouderUser());
////        System.out.println("============> parameter: "+parameter);
////    	List<Map<String, Object>> shopName = ktCommonService.getShopList2ZoneUser(parameter);
////		return JSONArray.fromObject(shopName);
//    }
//
//    /**
//     * 销售流水表，查询商品类型
//     */
//    @RequestMapping("/getGoodsType")
//    @ResponseBody
//    public JSONArray getGoodsType(HttpServletRequest request, HttpServletResponse response){
//
//    	JSONObject result = ktCountService.getGoodsType();
//    	Object goodsType = result.get("goodsType");
//    	JSONArray goodsTypeArray = JSONArray.fromObject(goodsType);
//		return goodsTypeArray;
//    }
//
//    /**
//     * 销售流水表，查询品牌
//     */
//    @RequestMapping("/getBrand")
//    @ResponseBody
//    public JSONArray getBrand(HttpServletRequest request, HttpServletResponse response){
//
//    	JSONObject result = ktCountService.getBrand();
//    	Object brand = result.get("brand");
//    	JSONArray brandArray = JSONArray.fromObject(brand);
//		return brandArray;
//    }
//
//    /**
//     * 销售流水表，查询供应商
//     */
//    @RequestMapping("/getSupplier")
//    @ResponseBody
//    public JSONArray getSupplier(HttpServletRequest request, HttpServletResponse response){
//
//    	JSONObject result = ktCountService.getSupplier();
//    	Object supplier = result.get("supplier");
//    	JSONArray supplierArray = JSONArray.fromObject(supplier);
//		return supplierArray;
//    }
//
//    /**
//     * 销售流水查询
//     */
//    @RequestMapping("/salesFlowList")
//    @ResponseBody
//    public Object salesFlowList(HttpServletRequest request, HttpServletResponse response){
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	JSONObject result = null;
//         result = ktCountService.salesFlowList(parameter);
//         Object flowList = result.get("flowList");
//    	return flowList;
//    }
//
//    /**
//     * 商品类型与品牌级联
//     */
//    @RequestMapping("/prodTypeLinkBrand")
//    @ResponseBody
//    public JSONArray prodTypeLinkBrand(HttpServletRequest request, HttpServletResponse response){
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//    	JSONObject result = ktCountService.prodTypeLinkBrand(parameter);
//    	Object brand = result.get("brand");
//    	JSONArray brandArray = JSONArray.fromObject(brand);
//		return brandArray;
//    }
//
//    /**
//     * 任务追踪表
//     * @param request
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/getktTaskAnalyse",produces = "application/json; charset=UTF-8")
//    public @ResponseBody
//    String getktTaskAnalyse(HttpServletRequest request) throws Exception {
//        request.setCharacterEncoding("utf-8");
//        Map<String, String> params = WebUtils.getAllParamMap(request);
//        JSONObject result = ktCountService.getktTaskAnalyse(params);
//        return result.toString();
//    }
//    /**
//     * 库存查询报表
//     */
//    @RequestMapping(value = "/storeQueryList",produces = "application/json; charset=UTF-8")
//    @ResponseBody
//    public String storeQueryList(HttpServletRequest request, HttpServletResponse response){
//    	Map<String,String> parameter = WebUtils.getAllParamMap(request);
//        JSONObject result = null;
//         result = ktCountService.storeQueryList(parameter);
//    	return result.toString();
//    }
//
//}
